package com.hackordie.daos.mappers;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.hackordie.commons.game.player.UserComponent;
import com.hackordie.constants.EComponentsType;

public class UserComponentMapper implements RowMapper<UserComponent> {

	@Override
	public UserComponent mapRow(final ResultSet result, final int row) throws SQLException {
	    UserComponent userComponent = new UserComponent();
		
	    userComponent.setIdComponentOnBag(result.getInt("idComponent"));
	    userComponent.setMounted(result.getBoolean("mounted"));	    	    
	    userComponent.setComponentType(EComponentsType.valueOf(result.getString("componentType")));
	    userComponent.setLife(result.getInt("life"));
	
		return userComponent;
	}
}
